const path = require("path");

const pkg = require("./package.json");

const version = pkg.version;
const name = pkg.name;

module.exports = {
  mode: "production",
  entry: "./src",
  //   打包成umd
  output: {
    path: path.resolve(__dirname, "dist"),
    filename: `${name}-${version}.min.js`,
    libraryTarget: "umd",
    library: "PageStorage",
    libraryExport: "default",
  },
  module: {
    rules: [
      {
        test: /\.ts$/,
        use: ["babel-loader", "ts-loader"],
        exclude: [path.resolve(__dirname, "node_modules")],
      },
    ],
  },
  resolve: {
    extensions: [".ts", ".js"],
  },

  // devtool: "inline-source-map"
};
